import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import vueSetupExtend from 'vite-plugin-vue-setup-extend' //通过调试工具能看到组件的名字

//CommonJS import形式规范导入path
//const path = require('path')
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueSetupExtend()],
  base: './',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  //  两个less文件是需要在多个组件中去使用的,每次使用都要重新导入,所有模板里都注入这2个文件
  css: {
    preprocessorOptions: {
      less: {
        additionalData: `
                @import "@/assets/styles/variables.less";
                @import "@/assets/styles/mixins.less";
            `,
      },
    },
  },
})
